import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);
import store from "../store";
import stationRouter from './modules/station'
import pointRouter from './modules/point'
// 根据菜单树，组装路由表
// const menuInfo = JSON.parse(localStorage.getItem("tree")) || [];
// const menuInfo = store.getters.menuRoutes;
// console.log("menuInfo", menuInfo)
// let dynRoutes = [];
// menuInfo.forEach(v => {
//   if (v.children) {
//     v.children.forEach(item => {
//       let obj = {
//         path: item.url,
//         name: item.name,
//         meta: { title: item.displayName },
//         component: () => import(`@/views/${v.name}/${item.name}.vue`)
//       }
//       dynRoutes.push(obj);
//     });
//   }
// });
// console.log(11111);
// console.log("store.getters.menuRoutes", store.getters.menuRoutes)

// if (!store.getters.menuRoutes) {
//   return
// }
let routes = [{
    path: "/login",
    name: "login",
    component: () => import("@/views/login/waterLogin.vue")
  },
  {
    path: "/",
    name: "Home",
    component: () => import("@/views/Home.vue"),
    redirect: "/home/map",
    children: [{
        path: "/home/map",
        name: "map",
        component: () => import("@/views/map/map.vue"),
        meta: {
          title: "首页"
        }
      },
      {
        path: "/home/water_map",
        name: "watermap",
        component: () => import("@/views/watermap/watermap.vue"),
        meta: {
          title: "水位站点"
        }
      },
      {
        path: "/home/surveillance",
        name: "surveillance",
        component: () => import("@/views/surveillance/surveillance.vue"),
        meta: {
          title: "水位站点"
        }
      },
      {
        path: "/home/equipment",
        name: "equipment",
        component: () => import("../views/equipment/equipment.vue"),
        meta: {
          title: "设备档案"
        }
      },
      {
        path: "/home/siteMange",
        name: "siteMange",
        component: () => import("../views/equipment/siteMange.vue"),
        meta: {
          title: "站点管理"
        }
      },
      {
        path: "/home/solarEnergyMange",
        name: "solarEnergyMange",
        component: () => import("../views/equipment/solarEnergyMange.vue"),
        meta: {
          title: "太阳能设备管理"
        }
      },

      {
        path: "/home/videoMange",
        name: "videoMange",
        component: () => import("../views/equipment/videoMange.vue"),
        meta: {
          title: "摄像头管理"
        }
      },
      {
        path: "/home/waterLevelMange",
        name: "waterLevelMange",
        component: () => import("../views/equipment/waterLevelMange.vue"),
        meta: {
          title: "水位设备管理"
        }
      },
      {
        path: "/home/rainfall",
        name: "rainfall",
        component: () => import("../views/equipment/rainfall.vue"),
        meta: {
          title: "降雨统计"
        }
      },
      {
        path: "/home/monitor",
        name: "monitor",
        component: () => import("../views/equipment/monitor.vue"),
        meta: {
          title: "雨量监测"
        }
      },
      {
        path: "/home/modify",
        name: "modify",
        component: () => import("../views/equipment/modify.vue"),
        meta: {
          title: "数据修改"
        }
      },
      {
        path: "/home/water_modify",
        name: "water_modify",
        component: () => import("../views/equipment/waterModify.vue"),
        meta: {
          title: "数据修改"
        }
      },
      {
        path: "/home/archives",
        name: "archives",
        component: () => import("../views/archives/archives.vue"),
        meta: {
          title: "雨情日报表"
        }
      },
      {
        path: "/home/sluice",
        name: "sluice",
        component: () => import("../views/archives/sluice.vue"),
        meta: {
          title: "雨情月报表"
        }
      },
      {
        path: "/home/monitors",
        name: "monitors",
        component: () => import("../views/archives/monitors.vue"),
        meta: {
          title: "雨情年报表"
        }
      },
      {
        path: "/home/rain",
        name: "rain",
        component: () => import("../views/archives/rain.vue"),
        meta: {
          title: "降雨日统计"
        }
      },
      {
        path: "/home/rain1",
        name: "rain1",
        component: () => import("../views/archives/rain1.vue"),
        meta: {
          title: "水位月统计"
        }
      },
      {
        path: "/home/structure",
        name: "structure",
        component: () => import("../views/structure/structure.vue"),
        meta: {
          title: "短信接收人"
        }
      },
      {
        path: "/home/record",
        name: "record",
        component: () => import("../views/structure/record.vue"),
        meta: {
          title: "发送记录"
        }
      },
      {
        path: "/home/journal",
        name: "journal",
        component: () => import("../views/journal/journal.vue"),
        meta: {
          title: "组织结构"
        }
      },
      {
        path: "/home/jurisdiction",
        name: "jurisdiction",
        component: () => import("../views/journal/jurisdiction.vue"),
        meta: {
          title: "菜单管理"
        }
      },
      {
        path: "/home/waring",
        name: "waring",
        component: () => import("../views/waring/waring.vue"),
        meta: {
          title: "菜单管理"
        }
      },
      {
        path: "/home/username",
        name: "username",
        component: () => import("../views/journal/username.vue"),
        meta: {
          title: "用户管理"
        }
      },
      {
        path: "/home/roles",
        name: "roles",
        component: () => import("../views/journal/roles.vue"),
        meta: {
          title: "角色管理"
        }
      },
      {
        path: "/home/logs",
        name: "logs",
        component: () => import("../views/journal/logs.vue"),
        meta: {
          title: "日志报表"
        }
      },
      {
        path: "/home/video",
        name: "video",
        component: () => import("../views/videolist/list1.vue"),
        meta: {
          title: "广利河西五路"
        }
      },
      {
        path: "/home/siteList",
        name: "siteList",
        component: () => import("../views/siteList/siteList.vue"),
        meta: {
          title: "视频列表"
        }
      },
      {
        path: "/home/video1",
        name: "videoList1",
        component: () => import("../views/videolist/list1.vue"),
        meta: {
          title: "广利河西五路"
        }
      },
      {
        path: "/home/video2",
        name: "videoList2",
        component: () => import("../views/videolist/list2.vue"),
        meta: {
          title: "广利河北二路"
        }
      },
      {
        path: "/home/video3",
        name: "videoList3",
        component: () => import("../views/videolist/list3.vue"),
        meta: {
          title: "广利河黄河路"
        }
      },
      {
        path: "/home/video4",
        name: "videoList4",
        component: () => import("../views/videolist/list4.vue"),
        meta: {
          title: "东营河庐山路"
        }
      },
      {
        path: "/home/video5",
        name: "videoList5",
        component: () => import("../views/videolist/list5.vue"),
        meta: {
          title: "六干排庐山路"
        }
      },
      {
        path: "/home/video10",
        name: "videoList6",
        component: () => import("../views/videolist/list10.vue"),
        meta: {
          title: "五六干合排西四路"
        }
      },
      {
        path: "/home/video8",
        name: "videoList8",
        component: () => import("../views/videolist/list8.vue"),
        meta: {
          title: "老广蒲沟南一路"
        }
      },
      {
        path: "/home/video6",
        name: "videoList6",
        component: () => import("../views/videolist/list6.vue"),
        meta: {
          title: "老广蒲沟西五路"
        }
      },
      {
        path: "/home/video9",
        name: "videoList9",
        component: () => import("../views/videolist/list9.vue"),
        meta: {
          title: "五六干合排西五路"
        }
      },
      {
        path: "/home/video7",
        name: "videoList7",
        component: () => import("../views/videolist/list7.vue"),
        meta: {
          title: "老广蒲沟西二路"
        }
      },
      {
        path: "/home/video11",
        name: "videoList11",
        component: () => import("../views/videolist/list11.vue"),
        meta: {
          title: "六干排西四路"
        }
      },
      {
        path: "/home/video12",
        name: "videoList12",
        component: () => import("../views/videolist/list12.vue"),
        meta: {
          title: "五干排西五路"
        }
      },
      {
        path: "/home/video13",
        name: "videoList13",
        component: () => import("../views/videolist/list13.vue"),
        meta: {
          title: "五干排西二路"
        }
      },
      {
        path: "/home/video14",
        name: "List14",
        component: () => import("../views/videolist/list14.vue"),
        meta: {
          title: "五干排南二路"
        }
      }
    ]
  },
  
  {
    path: "/flood",
    name: "flood",
    component: () => import("@/views/flood/prevention.vue")
  }
];
const router = new VueRouter({
  base: process.env.BASE_URL,
  scrollBehavior: () => ({
    x: 0,
    y: 0
  }),
  routes
});
// router.options.routes[1].children = router.options.routes[1].children.concat(store.getters.menuRoutes);
// router.addRoutes(router.options.routes);
export default router;

// import Vue from "vue";
// import Router from "vue-router";
// Vue.use(Router);
// export const _CONSTANTS_ROUTERS = [
//   {
//     path: "/login",
//     name: "login",
//     component: () => import("@/views/login/login.vue")
//   },
//   {
//     path: "/",
//     name: "Home",
//     component: () => import("@/views/Home.vue"),
//     redirect: "/home/map",
//     children: [
//       {
//         path: "/home/map",
//         name: "map",
//         component: () => import("@/views/map/map.vue"),
//         meta: {
//           title: "首页"
//         }
//       }
//     ]
//   }]
// export default new Router({
//   // mode: 'history', // require service support
//   scrollBehavior: () => ({ y: 0 }),
//   routes: _CONSTANTS_ROUTERS
// })